#version 330 core
layout(location = 0) in vec3 aPos;
layout(location = 1) in vec3 aOffset;
layout(location = 2) in vec2 aTexCoord;
layout(location = 3) in vec3 aColor;

out vec2 TexCoord;
out vec4 Color;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
uniform bool isLayeredDraw;
uniform bool isDrawHalfPixel;

void main()
{
	vec3 Position = aPos + aOffset;
	gl_Position = projection * view * model * vec4(-Position.x, Position.yz, 1.0f);
	if(!isLayeredDraw)
		TexCoord = aTexCoord;
	else
	{
		if(isDrawHalfPixel)
		{
			if(aOffset.x < 0)
				Color = vec4(aColor, 1.0f);
			else
				Color = vec4(0.0f);
		}
		else
			Color = vec4(aColor, 1.0f);
	}
}